package com.geek.factory.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.geek.factory.dto.DeviceRepairDTO;
import com.geek.factory.entity.DeviceRepair;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface DeviceRepairMapper extends BaseMapper<DeviceRepair> {


    @Select("SELECT dr.*, pl.line_name AS product_line_name " +
            "FROM device_repair dr " +
            "LEFT JOIN product_line pl ON dr.product_line_id = pl.id")
    List<DeviceRepairDTO> selectAllWithLineName();

    @Select("SELECT name FROM product_line WHERE id = #{id}")
    String getLineNameById(@Param("id") Long id);


}
